package com.xh.bussiness.course.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;

import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;

import com.xh.core.model.SuperEntity;
import com.xh.core.util.StringUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 *
 * </p>
 *
 * @author Jqm
 * @since 2021-02-05
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("bk_prepare_lesson_log")
public class PrepareLessonLog extends SuperEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 备课id
     */
    private String prepareLessonId;

    /**
     * 操作类型：1-提交备课  2-年级审核  3-校区审核  4-重新提交
     */
    private Integer operatType;

    /**
     * 审核结果：4-通过  5-不通过
     */
    private Integer checkStatus;

    /**
     * 拒绝理由
     */
    private String refuseReason;

    /**
     * 不通过内容：1-教案  2-还课视频
     */
    private String refuseContent;
    /**
     * 评分
     */
    private Double score;

    @TableField(exist = false)
    private PrepareLessonScore prepareLessonScore;
    /**
     *
     */
    @TableField(exist = false)
    private List<String> refuseContents;

    public String getRefuseContent() {
        if (refuseContents != null && refuseContents.size() > 0) {
            return StringUtils.joinList(refuseContents,",");
        }
        return null;
    }

    public List<String> getRefuseContents() {
        if (refuseContents != null && refuseContents.size() > 0) {
            return refuseContents;
        }
        if (StringUtils.isNotEmpty(refuseContent)) {
            return Arrays.asList(refuseContent.split(","));
        }
        return null;
    }
}
